<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>支付</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
    <link rel="stylesheet" th:href="@{/lib/weui.min.css}">
    <link rel="stylesheet" th:href="@{/css/jquery-weui.css}">
</head>

<body ontouchstart>

<header class='demos-header'>
    <h1 class="demos-title"></h1>
</header>

<div class="weui-cells weui-cells_form">
    <div class="weui-msg__text-area">
        <h1 class="weui-msg__title" th:text="${params.storeName}"></h1>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">消费金额（元）</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="number" placeholder="消费金额" id="consumeFee">
        </div>
    </div>

    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">押金（元）</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" id="fee" disabled="disabled" th:value="${params.freeze_fee}"/>
        </div>
    </div>
    <div class="weui-cell">
    </div>

    <div class="weui-msg__opr-area">
        <p class="weui-btn-area">
            <a id="disgitControl" class="weui-btn weui-btn_primary">确定</a>
        </p>
    </div>
</div>

<script th:src="@{/lib/jquery-2.1.4.js}"></script>
<script th:src="@{/lib/fastclick.js}"></script>
<script th:src="@{/js/jquery-weui.js}"></script>

<script>
    $(function () {
        FastClick.attach(document.body);
    });
</script>
<script th:inline="javascript">
    $(function () {
        var authen_code = [[${params.authen_code}]];
        var pay_platform = [[${params.pay_platform}]];
        var out_shop_id = [[${params.out_shop_id}]];
        var out_sub_mch_id = [[${params.out_sub_mch_id}]];
        var out_mch_id = [[${params.out_mch_id}]];
        var author_code = [[${params.author_code}]];
        var out_freeze_no = [[${params.out_freeze_no}]];
        var freeze_fee = [[${params.freeze_fee}]];
        var device_id = [[${params.device_id}]];


        $("#disgitControl").click(function () {
            var consumeFee = $("#consumeFee").val();

            if(consumeFee == null || consumeFee == undefined || consumeFee == NaN){
                $.toast("消费不能为空",1500);
                return;
            }
            var params = {};
            params.authen_code = authen_code;
            params.pay_platform = pay_platform;
            params.out_shop_id = out_shop_id;
            params.out_sub_mch_id = out_sub_mch_id;
            params.out_mch_id = out_mch_id;
            params.author_code = author_code;
            params.out_freeze_no = out_freeze_no;
            params.freeze_fee = freeze_fee;
            params.device_id = device_id;

            params.consumeFee = consumeFee;

            $.post("disgitControl", params,function (res) {
                if (res.code == 200) {
                    $.toast(res.message);
                } else {
                    $.toast(res.message, "cancel");
                }
            }, 'json')
        });
    })
</script>
</body>
</html>
